package com.ny.wlw

import java.io.FileOutputStream;
import java.io.IOException;
public class Shuru {
    public static void main(String[] args) {
        String filePath = "Shuru.txt";
        String date = "劳动节快乐";
        try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
            writer.write(data);
            System.out.println("数据写入成功");
        } catch (IOException e) {
            e.printStackTrace();
        }
        // 使用BufferedReader读取文件
        try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            String line;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
